Skip to content

feat(middleware): implement blockchain module #409

Merged
A6dulmalik merged 1 commit intoMindBlockLabs:mainfrom
Tinna23:Tinna23/issues-307-308-309-310
Mar 28, 2026
Merged

feat(middleware): implement blockchain module #409
A6dulmalik merged 1 commit intoMindBlockLabs:mainfrom
Tinna23:Tinna23/issues-307-308-309-310

Conversation

@Tinna23
Copy link
Copy Markdown
Contributor

@Tinna23 Tinna23 commented Mar 28, 2026

Summary

Implements all four Stellar Wave blockchain issues entirely within the middleware/ package at the repo root, adding a new middleware/src/blockchain/ module.
Adds stellar-sdk and @nestjs/config to middleware/package.json.
No changes made to the backend/ folder.

Issue #307 — Configure BlockchainModule and export BlockchainService:

  • Add BlockchainModule registering all four Soroban providers
  • BlockchainService exposes passthrough methods for all contract interactions
  • Imports ConfigModule; reads STELLAR_SECRET_KEY, STELLAR_CONTRACT_ID, STELLAR_RPC_URL, STELLAR_NETWORK_PASSPHRASE from environment

Issue #308 — Stellar wallet linking and on-chain player registration:

  • RegisterPlayerProvider calls register_player on Soroban after wallet link
  • LinkWalletProvider implements ORM-agnostic link-wallet business logic: validates Stellar address, checks for duplicate wallet, persists wallet, then fires registerPlayerOnChain non-blocking

Issue #309 — submitPuzzleOnChain after correct answer:

  • SubmitPuzzleProvider calls submit_puzzle with normalized 0-100 score
  • SyncXpMilestoneProvider calls sync_xp_milestone on level-up events

Issue #310 — Streak reconciliation with smart contract:

Closes #307
Closes #308
Closes #309
Closes #310

…s#307, MindBlockLabs#308, MindBlockLabs#309, MindBlockLabs#310

Issue MindBlockLabs#307 — Configure BlockchainModule and export BlockchainService:
- Add BlockchainModule registering all four Soroban providers
- BlockchainService exposes passthrough methods for all contract interactions
- Imports ConfigModule; reads STELLAR_SECRET_KEY, STELLAR_CONTRACT_ID,
  STELLAR_RPC_URL, STELLAR_NETWORK_PASSPHRASE from environment

Issue MindBlockLabs#308 — Stellar wallet linking and on-chain player registration:
- RegisterPlayerProvider calls `register_player` on Soroban after wallet link
- LinkWalletProvider implements ORM-agnostic link-wallet business logic:
  validates Stellar address, checks for duplicate wallet, persists wallet,
  then fires registerPlayerOnChain non-blocking

Issue MindBlockLabs#309 — submitPuzzleOnChain after correct answer:
- SubmitPuzzleProvider calls `submit_puzzle` with normalized 0-100 score
- SyncXpMilestoneProvider calls `sync_xp_milestone` on level-up events

Issue MindBlockLabs#310 — Streak reconciliation with smart contract:
- SyncStreakProvider calls `sync_streak` (gated behind STREAK_SYNC_ENABLED)
- Feature flag prevents runtime errors while contract Issue MindBlockLabs#2 is pending
- All blockchain calls are non-blocking and wrapped in try/catch
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@Tinna23 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Copy link
Copy Markdown
Member

@A6dulmalik A6dulmalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neatly delivered as required
Thanks for your contribution.

@A6dulmalik A6dulmalik merged commit 36f41c7 into MindBlockLabs:main Mar 28, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants